#include <stdio.h>
#include <string.h>

int strStr(char *haystack, char *needle)
{
    int len1 = strlen(haystack);
    int len2 = strlen(needle);
    for (int i = 0; i + len2 <= len1; i++)
    {
        int flag = 1;
        for (int j = 0; j < len2; j++)
        {
            if (haystack[i + j] != needle[j])
            {
                flag = 0;
            }
        }
        if (flag)
        {
            return i;
        }
    }
    return -1;
}

int main()
{
    char *haystack = "abc";
    char *needle = "abc";
    int ret = strStr(haystack, needle);
    printf("%d\n", ret);
}
